<?php

//$http_method = strtoupper($_SERVER['REQUEST_METHOD']);

$user_id = get_loggedin_userid();
$url = urldecode(get_input('url', ''));
$comment_id = urldecode(get_input('comment_id', '0'));

if ($user_id <= 0) {
    echo json_encode(array("status" => 501, "message" => "not authorized action!"));
    exit;
}
if ($url === '' ) {
    echo json_encode(array("status" => 500, "message" => "url can not be empty!"));
    exit;
}
if ($comment_id === '0' ) {
    echo json_encode(array("status" => 500, "message" => "comment_id can not be empty!"));
    exit;
}

$ok = GgsSocialObjects::removeComment($url, $comment_id);

if ($ok) {
    echo json_encode(array("status" => 200, "message" => "ok"));
    exit;
}
echo json_encode(array("status" => 500, "message" => "fail"));
exit;
